package com.xcf.controller.business.finance;

import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xcf.controller.base.BaseController;
import com.xcf.service.business.finance.FreightIncomeService;
import com.xcf.util.PageData;
import com.xcf.util.ResponseResult;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

@Controller
@RequestMapping(value = "/freight")
public class FreightIncomeController extends BaseController {
	@Resource
	private FreightIncomeService fright;
	String menuUrl = "freight/income"; // 菜单地址(权限用)

	@RequestMapping(value = "/income")
	public ModelAndView freight() {
		ModelAndView mv = new ModelAndView();
		mv.setViewName("/business/finance/receiptManage/freight_income");
		return mv;
	}

//	@RequestMapping(value = "xian")
//	public void xian(HttpServletResponse response) throws Exception {
//		PageData pd = new PageData();
//		pd = this.getPageData();
//		List<PageData> list = fright.sear(pd);
//		JSONArray arry = new JSONArray();
//		for (PageData fis : list) {
//			JSONObject ob = new JSONObject();
//			ob.put("id", fis.get("id"));
//			ob.put("receivables_invoice_code", fis.getString("receivables_invoice_code"));
//			ob.put("invoice_bill_code", fis.getString("invoice_bill_code"));//业务编号
//			ob.put("usd", fis.get("usd"));
//			ob.put("rmb", fis.get("rmb"));
//			ob.put("deductible_invoice_code", fis.getString("deductible_invoice_code"));
//			ob.put("deductible_bill_code", fis.getString("deductible_bill_code"));
//			ob.put("decuctible_usd", fis.get("decuctible_usd"));
//			ob.put("decuctible_rmb", fis.get("decuctible_rmb"));
//			ob.put("auditer", fis.get("auditer"));// 审核
//			arry.add(ob);
//		}
//		response.setContentType("text/html; charset=utf-8");
//		response.getWriter().write(
//				"{" + "\"" + "total" + "\"" + ":" + "\"" + "10" + "\"" + "," + "\"" + "rows" + "\"" + ":" + arry + "}");
//
//	}	
	@RequestMapping(value = "xian")
	@ResponseBody
	public ResponseResult findReceivablesInfo(int page)throws Exception{
		PageHelper.startPage(page, 10);
		PageData pd = new PageData();
		pd = this.getPageData();
		List<Map> list = fright.findReceivablesInfo(pd);
		return ResponseResult.success(new PageInfo(list));
	}
	// 部门
	@RequestMapping(value = "bumen")
	public void bumen(HttpServletResponse response) throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();
		JSONArray arry = new JSONArray();
		List<PageData> list = fright.serhbumen(pd);
		for (PageData fr : list) {
			JSONObject ob = new JSONObject();
			ob.put("DEPARTMENT_ID", fr.get("DEPARTMENT_IDd"));
			ob.put("DEPARTMENT_NAME", fr.getString("DEPARTMENT_NAME"));
			arry.add(ob);
		}
		response.setContentType("text/html; charset=utf-8");
		response.getWriter().write(
				"{" + "\"" + "total5" + "\"" + ":" + "\"" + "10" + "\"" + "," + "\"" + "rows5" + "\"" + ":" + arry + "}");
	}

	// 收入发票号
	@RequestMapping(value = "list")
	public void list(HttpServletResponse response) throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();
		JSONArray arry = new JSONArray();
		List<PageData> list = fright.serh(pd);
		for (PageData fr : list) {
			JSONObject ob = new JSONObject();
			ob.put("id", fr.get("id"));
			ob.put("code", fr.getString("code"));
			arry.add(ob);
		}
		response.setContentType("text/html; charset=utf-8");
		response.getWriter().write(
				"{" + "\"" + "total" + "\"" + ":" + "\"" + "10" + "\"" + "," + "\"" + "rows" + "\"" + ":" + arry + "}");
	}

	// 抵扣发票号
	@RequestMapping(value = "list2")
	public void list2(HttpServletResponse response) throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();
		JSONArray arry = new JSONArray();
		List<PageData> list = fright.serh(pd);
		for (PageData fr : list) {
			JSONObject ob = new JSONObject();
			ob.put("id", fr.get("id"));
			ob.put("code", fr.getString("code"));
			arry.add(ob);
		}
		response.setContentType("text/html; charset=utf-8");
		response.getWriter().write("{" + "\"" + "total2" + "\"" + ":" + "\"" + "10" + "\"" + "," + "\"" + "rows2" + "\""
				+ ":" + arry + "}");
	}

	// 收入业务编号
	@RequestMapping(value = "list3")
	public void list3(HttpServletResponse response) throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();
		JSONArray arry = new JSONArray();
		List<PageData> list = fright.serhye(pd);
		for (PageData fr : list) {
			JSONObject ob = new JSONObject();
			ob.put("ID", fr.get("ID"));
			ob.put("BILL_CODE", fr.getString("BILL_CODE"));
			arry.add(ob);
		}
		response.setContentType("text/html; charset=utf-8");
		response.getWriter().write("{" + "\"" + "total3" + "\"" + ":" + "\"" + "10" + "\"" + "," + "\"" + "rows3" + "\""
				+ ":" + arry + "}");
	}

	// 抵扣业务编号
	@RequestMapping(value = "list4")
	public void list4(HttpServletResponse response) throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();
		JSONArray arry = new JSONArray();
		List<PageData> list = fright.serhdi(pd);
		for (PageData fr : list) {
			JSONObject ob = new JSONObject();
			ob.put("ID", fr.get("ID"));
			ob.put("BILL_CODE", fr.getString("BILL_CODE"));
			arry.add(ob);
		}
		response.setContentType("text/html; charset=utf-8");
		response.getWriter().write("{" + "\"" + "total4" + "\"" + ":" + "\"" + "10" + "\"" + "," + "\"" + "rows4" + "\""
				+ ":" + arry + "}");
	}

	
	// 批量保存
	@RequestMapping(value = "/save")
	@ResponseBody
	public Object updateInfo() throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();

		String data = pd.getString("array");
		JSONArray items = JSONArray.fromObject(data);

//		for (int i = 0, size = items.size(); i < size; i++) {
//			JSONObject item = items.getJSONObject(i);
//			PageData pdq = new PageData();
//			if(item.getString("receipt_app_code")==null||item.getString("receipt_app_code")==""){
//				pdq.put("receipt_app_code", 151275);// 缴费单号
//			}else{
//				pdq.put("receipt_app_code",item.getString("receipt_app_code"));// 缴费单号
//			}
//			
//			pdq.put("payment_app_dept", item.getString("payment_app_dept"));// 部门
//			pdq.put("dept_business_type", item.getString("dept_business_type"));// 业务类别
//			pdq.put("payment_dept", item.getString("payment_dept"));// 付款单位
//			pdq.put("due_bank", item.getString("due_bank"));// 收款银行
//			pdq.put("remark", item.getString("remark"));// 备注
//			pdq.put("payment_method", item.getString("payment_method"));// 收款方式
//			/**
//			 * @author tanwei
//			 */
//			if (item.getString("receivables_invoice_code")==null || item.getString("receivables_invoice_code")=="") { //判断收入发票号是否为空，是，就修改审核状态
//				if(!item.getString("rmb").isEmpty()){
//					PageData CURRENCYANDCODE = new PageData();
//					CURRENCYANDCODE.put("CURRENCY", "RMB");
//					CURRENCYANDCODE.put("billCode", item.getString("invoice_bill_code"));
//					//完税金额
//					PageData amount = fright.findFeeAmount(CURRENCYANDCODE);
//					pdq.put("rmb_total_amount", amount.get("TAX_PRICE"));
//					//前期金额
//					PageData frontAmount = fright.findFrontAmount(item.getString("invoice_bill_code"));
//					float a;
//					if(frontAmount.get("rmb")==null){
//						pdq.put("rmb_early_receipt", 0);
//						 a = Float.parseFloat(amount.get("TAX_PRICE").toString())-0-Float.parseFloat(item.getString("rmb"));
//						 
//					}else{
//						 a = Float.parseFloat(amount.get("TAX_PRICE").toString())-Float.parseFloat(frontAmount.get("rmb").toString())-Float.parseFloat(item.getString("rmb"));
//						 pdq.put("rmb_early_receipt", frontAmount.get("rmb"));
//					}
//					
//					//余额
//					pdq.put("rmb_remaining_balance",a);
//				}else{
//					PageData CURRENCYANDCODE = new PageData();
//					CURRENCYANDCODE.put("CURRENCY", "USD");
//					CURRENCYANDCODE.put("billCode", item.getString("invoice_bill_code"));
//					//完税金额
//					PageData amount = fright.findFeeAmount(CURRENCYANDCODE);
//					pdq.put("usd_total_amount", amount.get("TAX_PRICE"));
//					//前期金额
//					PageData frontAmount = fright.findFrontAmount(item.getString("invoice_bill_code"));
//					float a;
//					if(frontAmount.get("usd")==null){
//						pdq.put("usd_early_receipt", 0);
//						a= Float.parseFloat(amount.get("TAX_PRICE").toString())-0-Float.parseFloat(item.getString("usd"));
//					}else{
//						pdq.put("usd_early_receipt", frontAmount.get("usd"));
//						a= Float.parseFloat(amount.get("TAX_PRICE").toString())-Float.parseFloat(frontAmount.get("usd").toString())-Float.parseFloat(item.getString("usd"));
//					}
//					
//					//余额
//					
//					pdq.put("usd_remaining_balance",a);
//				}
//				
//
//				
//				pdq.put("is_advance", 1);
//			} else {
//				if(!item.getString("rmb").isEmpty()){
//					PageData CURRENCYANDCODE = new PageData();
//					CURRENCYANDCODE.put("currency", "RMB");
//					CURRENCYANDCODE.put("invoice_code", item.getString("receivables_invoice_code"));
//					//如果amount为空，则是数据问题
//					PageData amount = fright.findInvoiceAllAmount(CURRENCYANDCODE);
//					pdq.put("rmb_total_amount", amount.get("tax_price"));
//					PageData frontAmount = fright.findFrontInvoiceAmount(item.getString("receivables_invoice_code"));
//					float a;
//					if(frontAmount.get("rmb")==null){
//						//第一次新增该币种
//						pdq.put("rmb_early_receipt", 0);
//						a = Float.parseFloat(amount.get("tax_price").toString())-0-Float.parseFloat(item.getString("rmb"));
//					}else{
//						pdq.put("rmb_early_receipt", frontAmount.get("rmb"));
//						a = Float.parseFloat(amount.get("tax_price").toString())-Float.parseFloat(frontAmount.get("rmb").toString())-Float.parseFloat(item.getString("rmb"));
//					}
//					
//					//余额
//					 
//					pdq.put("rmb_remaining_balance",a);
//				}else{
//					PageData CURRENCYANDCODE = new PageData();
//					CURRENCYANDCODE.put("currency", "USD");
//					CURRENCYANDCODE.put("invoice_code", item.getString("receivables_invoice_code"));
//					//完税金额
//					PageData amount = fright.findInvoiceAllAmount(CURRENCYANDCODE);
//					pdq.put("usd_total_amount", amount.get("tax_price"));
//					//前期金额
//					PageData frontAmount = fright.findFrontInvoiceAmount(item.getString("receivables_invoice_code"));
//					float a;
//					if(frontAmount.get("usd")==null){
//						pdq.put("usd_early_receipt", 0);
//						a = Float.parseFloat(amount.get("tax_price").toString())-0-Float.parseFloat(item.getString("usd"));
//					}else{
//						pdq.put("usd_early_receipt", frontAmount.get("usd"));
//						a = Float.parseFloat(amount.get("tax_price").toString())-Float.parseFloat(frontAmount.get("usd").toString())-Float.parseFloat(item.getString("usd"));
//					}
//					
//					//余额
//					pdq.put("usd_remaining_balance",a);
//				}
//				pdq.put("is_advance", 0);
//			}
//			/**完*/
//			pdq.put("receivables_invoice_code", item.getString("receivables_invoice_code"));// 收入发票号
//			pdq.put("invoice_bill_code", item.getString("invoice_bill_code"));// 收入业务编号
//			pdq.put("usd", item.get("usd"));// 收入美元
//			pdq.put("rmb", item.get("rmb"));// 收入人民币
//			pdq.put("deductible_invoice_code", item.getString("deductible_invoice_code"));// 抵扣发票号
//			pdq.put("deductible_bill_code", item.getString("deductible_bill_code"));// 抵扣业务编号
//			pdq.put("decuctible_usd", item.get("decuctible_usd"));// 抵扣美元
//			pdq.put("decuctible_rmb", item.get("decuctible_rmb"));// 抵扣人民币
//			if (item.getString("id").isEmpty()) {
//				fright.save(pdq);
//			} else {
//				pdq.put("id", item.get("id"));
//				pdq.put("receipt_app_code", item.getString("receipt_app_code"));
//				fright.updit(pdq);
//			}
//		}
		String pp1 = null;
		if(pd.getString("receipt_app_code").isEmpty()){
			
			PageData b = new PageData();
			b.put("paymentCode", null);
			Object pp = fright.getPaymentCode(b);
			pp1 = pp.toString();
		}else{
			pp1 = pd.getString("receipt_app_code");
		}
			
			

			
	
		for (int i = 0, size = items.size(); i < size; i++) {
			JSONObject item = items.getJSONObject(i);
			PageData pdq = new PageData();
//			if(pd.getString("receipt_app_code").isEmpty()){
//				pdq.put("receipt_app_code", pp1);// 缴费单号
//			}else{
//				pdq.put("receipt_app_code",pd.getString("receipt_app_code"));// 缴费单号
//			}
			
			/**
			 * @author tanwei
			 */
//			if (item.getString("receivables_invoice_code")==null || item.getString("receivables_invoice_code")=="") { //判断收入发票号是否为空，是，就修改审核状态
//				if(!item.getString("rmb").isEmpty()){
//					PageData CURRENCYANDCODE = new PageData();
//					CURRENCYANDCODE.put("CURRENCY", "RMB");
//					CURRENCYANDCODE.put("billCode", item.getString("invoice_bill_code"));
//					//完税金额
//					PageData amount = fright.findFeeAmount(CURRENCYANDCODE);
//					pdq.put("rmb_total_amount", amount.get("TAX_PRICE"));
//					//前期金额
//					PageData frontAmount = fright.findFrontAmount(item.getString("invoice_bill_code"));
//					float a;
//					if(frontAmount.get("rmb")==null){
//						pdq.put("rmb_early_receipt", 0);
//						 a = Float.parseFloat(amount.get("TAX_PRICE").toString())-0-Float.parseFloat(item.getString("rmb"));
//						 
//					}else{
//						 a = Float.parseFloat(amount.get("TAX_PRICE").toString())-Float.parseFloat(frontAmount.get("rmb").toString())-Float.parseFloat(item.getString("rmb"));
//						 pdq.put("rmb_early_receipt", frontAmount.get("rmb"));
//					}
//					
//					//余额
//					pdq.put("rmb_remaining_balance",a);
//				}else{
//					PageData CURRENCYANDCODE = new PageData();
//					CURRENCYANDCODE.put("CURRENCY", "USD");
//					CURRENCYANDCODE.put("billCode", item.getString("invoice_bill_code"));
//					//完税金额
//					PageData amount = fright.findFeeAmount(CURRENCYANDCODE);
//					pdq.put("usd_total_amount", amount.get("TAX_PRICE"));
//					//前期金额
//					PageData frontAmount = fright.findFrontAmount(item.getString("invoice_bill_code"));
//					float a;
//					if(frontAmount.get("usd")==null){
//						pdq.put("usd_early_receipt", 0);
//						a= Float.parseFloat(amount.get("TAX_PRICE").toString())-0-Float.parseFloat(item.getString("usd"));
//					}else{
//						pdq.put("usd_early_receipt", frontAmount.get("usd"));
//						a= Float.parseFloat(amount.get("TAX_PRICE").toString())-Float.parseFloat(frontAmount.get("usd").toString())-Float.parseFloat(item.getString("usd"));
//					}
//					
//					//余额
//					
//					pdq.put("usd_remaining_balance",a);
//				}
//				
//
//				
//				pdq.put("is_advance", 1);
//			} else {
//				if(!item.getString("rmb").isEmpty()){
//					PageData CURRENCYANDCODE = new PageData();
//					CURRENCYANDCODE.put("currency", "RMB");
//					CURRENCYANDCODE.put("invoice_code", item.getString("receivables_invoice_code"));
//					//如果amount为空，则是数据问题
//					PageData amount = fright.findInvoiceAllAmount(CURRENCYANDCODE);
//					pdq.put("rmb_total_amount", amount.get("tax_price"));
//					PageData frontAmount = fright.findFrontInvoiceAmount(item.getString("receivables_invoice_code"));
//					float a;
//					if(frontAmount.get("rmb")==null){
//						//第一次新增该币种
//						pdq.put("rmb_early_receipt", 0);
//						a = Float.parseFloat(amount.get("tax_price").toString())-0-Float.parseFloat(item.getString("rmb"));
//					}else{
//						pdq.put("rmb_early_receipt", frontAmount.get("rmb"));
//						a = Float.parseFloat(amount.get("tax_price").toString())-Float.parseFloat(frontAmount.get("rmb").toString())-Float.parseFloat(item.getString("rmb"));
//					}
//					
//					//余额
//					 
//					pdq.put("rmb_remaining_balance",a);
//				}else{
//					PageData CURRENCYANDCODE = new PageData();
//					CURRENCYANDCODE.put("currency", "USD");
//					CURRENCYANDCODE.put("invoice_code", item.getString("receivables_invoice_code"));
//					//完税金额
//					PageData amount = fright.findInvoiceAllAmount(CURRENCYANDCODE);
//					pdq.put("usd_total_amount", amount.get("tax_price"));
//					//前期金额
//					PageData frontAmount = fright.findFrontInvoiceAmount(item.getString("receivables_invoice_code"));
//					float a;
//					if(frontAmount.get("usd")==null){
//						pdq.put("usd_early_receipt", 0);
//						a = Float.parseFloat(amount.get("tax_price").toString())-0-Float.parseFloat(item.getString("usd"));
//					}else{
//						pdq.put("usd_early_receipt", frontAmount.get("usd"));
//						a = Float.parseFloat(amount.get("tax_price").toString())-Float.parseFloat(frontAmount.get("usd").toString())-Float.parseFloat(item.getString("usd"));
//					}
//					
//					//余额
//					pdq.put("usd_remaining_balance",a);
//				}
//				pdq.put("is_advance", 0);
//			}
			/**完*/
			pdq.put("receipt_app_code", pp1);
			String cost_id = this.get32UUID();
			pdq.put("invoice_code", item.getString("receivables_invoice_code"));// 收入发票号
			pdq.put("bill_code", item.getString("invoice_bill_code"));// 收入业务编号
//			pdq.put("usd_amount", item.get("usd"));// 收入美元
			if(item.get("usd")!=null&&item.get("usd")!=""&&!item.getString("usd").equals("null")&&!item.getString("usd").equals("")){
				float a = Float.parseFloat(item.get("usd").toString());
				pdq.put("usd_amount", a);
			}
//			pdq.put("rmb_amount", item.get("rmb"));// 收入人民币
			if(item.get("rmb")!=null&&item.get("rmb")!=""&&!item.getString("rmb").equals("null")&&!item.getString("rmb").equals("")){
				float a = Float.parseFloat(item.get("rmb").toString());
				pdq.put("rmb_amount", a);
			}
			pdq.put("cost_id", cost_id);
			if(item.getString("id").isEmpty()){
				fright.saveReceivablesCotsDetail(pdq);
			}else{
				pdq.put("id", item.get("id"));
				fright.updateReceivablesCotsDetail(pdq);
			}
			PageData pdq1 = new PageData();
//			if(pd.getString("receipt_app_code")==null||pd.getString("receipt_app_code")==""){
//				pdq1.put("receipt_app_code", pp1);// 缴费单号
//			}else{
//				pdq1.put("receipt_app_code",pd.getString("receipt_app_code"));// 缴费单号
//			}
			pdq1.put("receipt_app_code", pp1);
			pdq1.put("receipt_app_code",pd.getString("receipt_app_code"));
			pdq1.put("invoice_code", item.getString("deductible_invoice_code"));// 抵扣发票号
			pdq1.put("bill_code", item.getString("deductible_bill_code"));// 抵扣业务编号
//			pdq1.put("usd_amount", item.get("decuctible_usd"));// 抵扣美元
			if(item.get("decuctible_usd")!=null&&item.get("decuctible_usd")!=""&&!item.getString("decuctible_usd").equals("null")&&!item.getString("decuctible_usd").equals("")){
				float a = Float.parseFloat(item.get("decuctible_usd").toString());
				pdq1.put("usd_amount", a);
			}
//			pdq1.put("rmb_amount", item.get("decuctible_rmb"));// 抵扣人民币
			if(item.get("decuctible_rmb")!=null&&item.get("decuctible_rmb")!=""&&!item.getString("decuctible_rmb").equals("null")&&!item.getString("decuctible_rmb").equals("")){
				float a = Float.parseFloat(item.get("decuctible_rmb").toString());
				pdq1.put("rmb_amount", a);
			}
			pdq1.put("cost_id", cost_id);
			if (item.get("receivableId").toString().isEmpty()) {
				fright.saveReceivablesDeductibleDetail(pdq1);
			} else {
//				pdq.put("id", item.get("id"));
//				pdq.put("receipt_app_code", item.getString("receipt_app_code"));
//				fright.updit(pdq);
				pdq1.put("id", item.get("receivableId"));
				fright.updateReceivablesDeductibleDetail(pdq1);
			}
		}
		PageData pdqw = new PageData();
		pdqw.put("receipt_app_code", pp1);
		pdqw.put("payment_app_dept", pd.getString("payment_app_dept"));// 部门
		pdqw.put("dept_business_type", pd.getString("dept_business_type"));// 业务类别
		pdqw.put("payment_dept", pd.getString("payment_dept"));// 付款单位
		pdqw.put("due_bank", pd.getString("due_bank"));// 收款银行
		pdqw.put("remark", pd.getString("remark"));// 备注
		pdqw.put("payment_method", pd.getString("payment_method"));// 收款方式
		if(pd.getString("receipt_app_code").isEmpty()){
			fright.saveReceivablesCostInfo(pdqw);
		}else{
			fright.updateReceivablesCostInfo(pdqw);
		}
		
		return null;
	}

	// 展示
	@RequestMapping(value = "/display")
	public void display(HttpServletResponse response) throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();
		JSONArray arry = new JSONArray();
		List<PageData> list = fright.seach(pd);
		for (PageData fis : list) {
			JSONObject ob = new JSONObject();
			ob.put("id", fis.get("id"));
			ob.put("receipt_app_code", fis.getString("receipt_app_code"));
			ob.put("payment_app_dept", fis.getString("payment_app_dept"));//部门
			ob.put("dept_business_type", fis.getString("dept_business_type"));//业务类型
			ob.put("payment_dept", fis.getString("payment_dept"));
			ob.put("due_bank", fis.getString("due_bank"));
			ob.put("remark", fis.getString("remark"));
			ob.put("payment_method", fis.getString("payment_method"));
			ob.put("receivables_invoice_code", fis.getString("receivables_invoice_code"));
			ob.put("invoice_bill_code", fis.getString("invoice_bill_code"));
			ob.put("usd", fis.get("usd"));
			ob.put("rmb", fis.get("rmb"));
			ob.put("deductible_invoice_code", fis.getString("deductible_invoice_code"));
			ob.put("deductible_bill_code", fis.getString("deductible_bill_code"));
			ob.put("decuctible_usd", fis.get("decuctible_usd"));
			ob.put("dept_business_rmb", fis.get("decuctible_rmb"));
			arry.add(ob);
		}
		response.setContentType("text/html; charset=utf-8");
		response.getWriter().write("{" + "\"" + "total10" + "\"" + ":" + "\"" + "10" + "\"" + "," + "\"" + "rows10"
				+ "\"" + ":" + arry + "}");
	}

	// 查询导入列表展示
	@RequestMapping(value = "/aa")
	@ResponseBody
	public Object aa(int page ,int limit) throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();
		PageHelper.startPage(page, limit);	
		//JSONArray arry = new JSONArray();
		List<PageData> list = fright.search(pd);
		return ResponseResult.success(new PageInfo(list));
/*		for (PageData fis : list) {
			JSONObject ob = new JSONObject();
			ob.put("receipt_app_code", fis.getString("receipt_app_code"));//交款单号
			ob.put("payment_app_dept", fis.getString("payment_app_dept"));//部门
			ob.put("dept_business_type", fis.getString("dept_business_type"));//业务类型
			ob.put("payment_dept", fis.getString("payment_dept"));//付款单位
			ob.put("due_bank", fis.getString("due_bank"));//付款银行
			ob.put("remark", fis.getString("remark"));//备注
			ob.put("payment_method", fis.getString("payment_method"));//收款方式
			ob.put("usd", fis.get("USDS"));//收入usd总和
			ob.put("rmb", fis.get("RMBS"));//收入rmb总和
			ob.put("decuctible_usd", fis.get("USDD"));//抵扣usd总和
			ob.put("dept_business_rmb", fis.get("RMBD"));//抵扣rmb总和
			arry.add(ob);
		}
		response.setContentType("text/html; charset=utf-8");
		response.getWriter().write("{" + "\"" + "total11" + "\"" + ":" + "\"" + "5" + "\"" + "," + "\"" + "rows11"
				+ "\"" + ":" + arry + "}");*/
	}

	// 单选删除
	@RequestMapping(value = "/dele")
	@ResponseBody
	public String dele() throws Exception {
		PageData pd = new PageData();
		pd = this.getPageData();
		fright.dele(pd);

		return null;
	}

}
